<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Pixbufs: GDK 3 Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="GDK 3 Reference Manual">
<link rel="up" href="reference.html" title="API Reference">
<link rel="prev" href="gdk3-Points-Rectangles-and-Regions.html" title="Points and Rectangles">
<link rel="next" href="gdk3-RGBA-Colors.html" title="RGBA Colors">
<meta name="generator" content="GTK-Doc V1.33.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#gdk3-Pixbufs.description" class="shortcut">Description</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="reference.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="gdk3-Points-Rectangles-and-Regions.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="gdk3-RGBA-Colors.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="gdk3-Pixbufs"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gdk3-Pixbufs.top_of_page"></a>Pixbufs</span></h2>
<p>Pixbufs — Functions for obtaining pixbufs</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="gdk3-Pixbufs.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_proto_type">
<col class="functions_proto_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<span class="returnvalue">GdkPixbuf</span> *
</td>
<td class="function_name">
<a class="link" href="gdk3-Pixbufs.html#gdk-pixbuf-get-from-window" title="gdk_pixbuf_get_from_window ()">gdk_pixbuf_get_from_window</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">GdkPixbuf</span> *
</td>
<td class="function_name">
<a class="link" href="gdk3-Pixbufs.html#gdk-pixbuf-get-from-surface" title="gdk_pixbuf_get_from_surface ()">gdk_pixbuf_get_from_surface</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="gdk3-Pixbufs.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;gdk/gdk.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="gdk3-Pixbufs.description"></a><h2>Description</h2>
<p>Pixbufs are client-side images. For details on how to create
and manipulate pixbufs, see the <span class="type">GdkPixbuf</span> API documentation.</p>
<p>The functions described here allow to obtain pixbufs from
<a href="gdk3-Windows.html#GdkWindow-struct"><span class="type">GdkWindows</span></a> and cairo surfaces.</p>
</div>
<div class="refsect1">
<a name="gdk3-Pixbufs.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="gdk-pixbuf-get-from-window"></a><h3>gdk_pixbuf_get_from_window ()</h3>
<pre class="programlisting"><span class="returnvalue">GdkPixbuf</span> *
gdk_pixbuf_get_from_window (<em class="parameter"><code><a class="link" href="gdk3-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a> *window</code></em>,
                            <em class="parameter"><code><span class="type">gint</span> src_x</code></em>,
                            <em class="parameter"><code><span class="type">gint</span> src_y</code></em>,
                            <em class="parameter"><code><span class="type">gint</span> width</code></em>,
                            <em class="parameter"><code><span class="type">gint</span> height</code></em>);</pre>
<p>Transfers image data from a <a class="link" href="gdk3-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a> and converts it to an RGB(A)
representation inside a <span class="type">GdkPixbuf</span>. In other words, copies
image data from a server-side drawable to a client-side RGB(A) buffer.
This allows you to efficiently read individual pixels on the client side.</p>
<p>This function will create an RGB pixbuf with 8 bits per channel with
the size specified by the <em class="parameter"><code>width</code></em>
 and <em class="parameter"><code>height</code></em>
 arguments scaled by the
scale factor of <em class="parameter"><code>window</code></em>
. The pixbuf will contain an alpha channel if
the <em class="parameter"><code>window</code></em>
 contains one.</p>
<p>If the window is off the screen, then there is no image data in the
obscured/offscreen regions to be placed in the pixbuf. The contents of
portions of the pixbuf corresponding to the offscreen region are undefined.</p>
<p>If the window you’re obtaining data from is partially obscured by
other windows, then the contents of the pixbuf areas corresponding
to the obscured regions are undefined.</p>
<p>If the window is not mapped (typically because it’s iconified/minimized
or not on the current workspace), then <code class="literal">NULL</code> will be returned.</p>
<p>If memory can’t be allocated for the return value, <code class="literal">NULL</code> will be returned
instead.</p>
<p>(In short, there are several ways this function can fail, and if it fails
 it returns <code class="literal">NULL</code>; so check the return value.)</p>
<div class="refsect3">
<a name="gdk-pixbuf-get-from-window.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>window</p></td>
<td class="parameter_description"><p>Source window</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>src_x</p></td>
<td class="parameter_description"><p>Source X coordinate within <em class="parameter"><code>window</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>src_y</p></td>
<td class="parameter_description"><p>Source Y coordinate within <em class="parameter"><code>window</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>width</p></td>
<td class="parameter_description"><p>Width in pixels of region to get</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>height</p></td>
<td class="parameter_description"><p>Height in pixels of region to get</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gdk-pixbuf-get-from-window.returns"></a><h4>Returns</h4>
<p>A newly-created pixbuf with a
reference count of 1, or <code class="literal">NULL</code> on error. </p>
<p><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>][<acronym title="The caller owns the data, and is responsible for free it."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-get-from-surface"></a><h3>gdk_pixbuf_get_from_surface ()</h3>
<pre class="programlisting"><span class="returnvalue">GdkPixbuf</span> *
gdk_pixbuf_get_from_surface (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> *surface</code></em>,
                             <em class="parameter"><code><span class="type">gint</span> src_x</code></em>,
                             <em class="parameter"><code><span class="type">gint</span> src_y</code></em>,
                             <em class="parameter"><code><span class="type">gint</span> width</code></em>,
                             <em class="parameter"><code><span class="type">gint</span> height</code></em>);</pre>
<p>Transfers image data from a <a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> and converts it to an RGB(A)
representation inside a <span class="type">GdkPixbuf</span>. This allows you to efficiently read
individual pixels from cairo surfaces. For <a href="gdk3-Windows.html#GdkWindow-struct"><span class="type">GdkWindows</span></a>, use
<a class="link" href="gdk3-Pixbufs.html#gdk-pixbuf-get-from-window" title="gdk_pixbuf_get_from_window ()"><code class="function">gdk_pixbuf_get_from_window()</code></a> instead.</p>
<p>This function will create an RGB pixbuf with 8 bits per channel.
The pixbuf will contain an alpha channel if the <em class="parameter"><code>surface</code></em>
 contains one.</p>
<div class="refsect3">
<a name="gdk-pixbuf-get-from-surface.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>surface</p></td>
<td class="parameter_description"><p>surface to copy from</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>src_x</p></td>
<td class="parameter_description"><p>Source X coordinate within <em class="parameter"><code>surface</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>src_y</p></td>
<td class="parameter_description"><p>Source Y coordinate within <em class="parameter"><code>surface</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>width</p></td>
<td class="parameter_description"><p>Width in pixels of region to get</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>height</p></td>
<td class="parameter_description"><p>Height in pixels of region to get</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gdk-pixbuf-get-from-surface.returns"></a><h4>Returns</h4>
<p>A newly-created pixbuf with a
reference count of 1, or <code class="literal">NULL</code> on error. </p>
<p><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>][<acronym title="The caller owns the data, and is responsible for free it."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.33.1</div>
</body>
</html>